#ifndef CONTACTTLISTWIDGET_H
#define CONTACTTLISTWIDGET_H

#include <QTreeWidget>
#include <QMap>
#include "contactlistitem.h"
#include <gloox/jid.h>
#include <gloox/rostermanager.h>
#include "localroster.h"

#include <QDebug>

using namespace gloox;

class ContacttListWidget : public QTreeWidget
{
    Q_OBJECT
public:
    enum Columns {
        StatusColumn,
        TextColumn,
        MoodColumn
    };

private:
    // Match column type with its position in widget
    QMap<Columns, int> columnId;
    QMap<JID, ContactListItem*> items;

    // Options
    bool showOfflineUsers;
    bool showGroups;

public:
    explicit ContacttListWidget(QWidget *parent = 0);

    void addContact(gloox::JID);
    void addTopLevelItem(ContactListItem *item);
signals:

public slots:
    void itemAdded (const JID &jid, const JID &clientJid);
    void itemSubscribed (const JID &jid, const JID &clientJid);
    void itemRemoved (const JID &jid, const JID &clientJid);
    void itemUpdated (const JID &jid, const JID &clientJid);
    void itemUnsubscribed (const JID &jid, const JID &clientJid);
    void rosterRecieved (const Roster &roster, const JID &clientJid);
    void rosterPresence (const RosterItem &item, const QString& resource, Presence::PresenceType presence, const QString& msg, const JID &clientJid);
    void selfPresence (const RosterItem &item, const QString& resource, Presence::PresenceType presence, const QString& msg, const JID &clientJid);
    void subscriptionRequest (const JID &jid, const QString& msg, const JID &clientJid);
    void unsubscriptionRequest (const JID &jid, const QString& msg, const JID &clientJid);
    void nonrosterPresence (const Presence &presence, const JID &clientJid);
    void rosterError (const IQ &iq, const JID &clientJid);
};

#endif // CONTACTTLISTWIDGET_H
